import csv
import random

P = [160, 320, 480, 640, 800]
K = 3.14 * 5 * (1 - 0.0625) / 40
L1 = P[0] / 201.8340761 * K
list1 = []
count = 1
with open("新建文本文档(1).txt", encoding="utf-8") as f:
    lines = f.readlines()
    for line in lines:
        if count % 2 == 0:
            list1.append(int(line))
        count += 1
# list1.sort()
res = []
for E in list1:
    e = E
    for i in range(3):
        derta1 = random.uniform(0.1, 0.6)
        temp1 = [E, round(derta1, 4)]
        res.append(temp1)
        l2Sum = [0, 0, 0, 0, 0, 0]
        l2Sum[0] = round(random.uniform(11.2, 12.8), 2)
        l2Sum[1] = l2Sum[0] - round(random.uniform(0.1, 0.3), 2)
        l2Sum[2] = l2Sum[1] - round(random.uniform(0.1, 0.3), 2)
        l2Sum[3] = l2Sum[2] - round(random.uniform(0.1, 0.3), 2)
        l2Sum[4] = l2Sum[3] - round(random.uniform(0.1, 0.3), 2)
        l2Sum[5] = l2Sum[4] - round(random.uniform(0.1, 0.3), 2)
        index = 0
        for p in P:
            l2 = l2Sum[index]
            index += 1
            e += round(random.uniform(-0.4, 0.4), 3)
            p += random.uniform(-1, 1)
            lx = p / e * K
            lc = lx + derta1
            l1 = round(l2 - 2 * lc, 2)
            raodong1 = random.uniform(0, 0.1)
            raodong2 = random.uniform(0, 0.1)
            z1 = round(l1 / 2 - raodong1, 2)
            z2 = round(l1 - z1, 2)
            y1 = round(l2 / 2 - raodong2, 2)
            y2 = round(l2 - y1, 2)
            temp2 = [z1, z2, round((z1 + z2) / 2, 3), y1, y2, round((y1 + y2) / 2, 3)]
            res.append(temp2)
for result in res:
    print(result)
with open("MakeFakeData.csv", 'w', newline='') as f:
    f_csv = csv.writer(f)
    for result in res:
        f_csv.writerow(result)










